package com.wuyu.user.controller;

import com.wuyu.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/getAccountBalance")
    public double getAccount(Long userId){
        return userService.getUserBalance(userId);
    }

    @Value("${account.name}")
    private String accountName;

    @Value("${account.balance}")
    private Double balance;

    @GetMapping("/getAccountInfo")
    public String getAccountInfo(){
        return "账户："+accountName+",余额："+balance;
    }

}
